<template>
<div class="page-container">
    <div class="common-content">
        <!-- 列表搜索条件部分 label宽度要固定,优先展示输入框和下拉框 ;时间选择和地区选择放置在最后,因为后两个的尺寸表较大,换行后会导致整体对不齐 -->
        <div class="search-wrap">
            <el-form :inline='true' :model="searchFilters" :size="searchSize" ref="searchFilters" label-position="right" label-width="120px" style="padding-top:20px">
                <el-form-item label="积分卡申请编码">
                    <el-input v-model="searchFilters.code" placeholder="请输入积分卡申请编码"></el-input>
                </el-form-item>
                <el-form-item label="积分卡类型">
                    <el-select v-model="searchFilters.type" clearable placeholder="全部">
                        <el-option label="权益卡" :value="1"></el-option>
                        <el-option label="海星卡" :value="2"></el-option>
                        <el-option label="定制卡" :value="3"></el-option>
                        <el-option label="贵宾卡" :value="4"></el-option>
                        <el-option label="智慧套餐卡" :value="5"></el-option>
                        <el-option label="城市定制卡" :value="5"></el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="活动过期时间" style="width:450px">
                    <el-date-picker size="large" style="width:380px" v-model="searchFilters.expiration" value-format="yyyy-MM-dd HH:mm:ss" type="datetimerange" range-separator="至"  start-placeholder="开始时间"  end-placeholder="结束时间">
                    </el-date-picker>
                </el-form-item>
                <el-form-item label="采购类型">
                    <el-select v-model="searchFilters.purchaseType" clearable placeholder="全部">
                        <el-option label="中心采购" :value="1"></el-option>
                        <el-option label="产品线采购" :value="2"></el-option>
                        <el-option label="渠道采购" :value="3"></el-option>
                        <el-option label="平台采购" :value="4"></el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="平台">
                    <el-select v-model="searchFilters.firstDemandCode" clearable placeholder="全部">
                        <el-option v-for="(item,index) in platformList" :label="item.name" :value="item.code" :key="index">
                        </el-option>
                    </el-select>
                </el-form-item>
                <!-- 搜索区域按钮-查询,重置 -->
                <div class="tool-wrap" width="800px" style="text-align:left">
                    <div class="left-area" width="800px">
                        <el-button-group width="800px">
                            <el-button type="primary" size="small" @click="selectSatus=='audit'?findPage():findPages()">查询</el-button>
                            <el-button type="primary" size="small" @click="resetForm()">重置</el-button>
                            <el-button type="primary" size="small" @click="addForm()" v-show="selectSatus=='audit'">新增</el-button>
                        </el-button-group>
                    </div>
                </div>
                <div class="tool-wrap" width="800px" style="text-align:left;" v-show="selectSatus=='audit'">
                    <el-button type="primary" size="small" @click="firstInstance('pass')">批量一审通过</el-button>
                    <el-button type="primary" size="small" @click="firstInstance('notGo')">批量一审不通过</el-button>
                    <el-button type="primary" size="small" @click="verify('pass')">批量核审通过</el-button>
                    <el-button type="primary" size="small" @click="verify('null')">批量核审不通过</el-button>
                    <el-button type="primary" size="small" @click="batchExport">批量导出</el-button>
                    <el-button type="primary" size="small">批量导入终端竞争力</el-button>
                    <el-button type="primary" size="small" @click="postpone">批量延期</el-button>
                    <el-button type="primary" size="small">批量延期模板下载</el-button>
                </div>
                  <div class="tool-wrap" width="800px" style="text-align:left;" v-show="selectSatus=='checked'">
                            <el-button type="primary" size="small" @click="batchExport">批量导出</el-button>
                            <el-button type="primary" size="small" @click="massProduction">批量生成卡片</el-button>
                            <el-button type="primary" size="small" @click="releasePointCart()">释放全部积分卡</el-button>
                  </div>
                <el-tabs v-model="selectSatus">
                    <el-tab-pane label="审核中" name="audit"></el-tab-pane>
                    <el-tab-pane label="已审核" name="checked"></el-tab-pane>
                </el-tabs>
                <!-- 表格数据部分 -->
                <div class="table-wrap" style="padding-top:20px">
                    <jic-table :height="350" :operationWidth="300" :tableList="tableList" 
                    @selectionChange="selectionChange" :tableHeaderList="selectSatus=='audit'?tableHeaderList:tableHeaderLists" 
                    :totalSize="totalSize" :showDetailOperation=true :showEditOperation="true" :showBatchDelete="false" :showSelection="true" 
                    :showIndex=false :showDeleteOperation="selectSatus=='audit'" @findPage="selectSatus=='audit'?findPage:findPages" @handleDetail="handleDetail" @handleDelete="handleDelete" 
                    @handleEdit="handleEdit" @handleSizeChange="handleSizeChange" @handlePageChange="handlePageChange" ref="jicTable"></jic-table>
                </div>
            </el-form>
        </div>
        <!--审核-->
        <el-dialog title="核审原因" :visible.sync="choseModel" width="45%" height="100%" label-width="100px" label-position="right">
            <el-form label-width="100px" label-position="left">
                <el-row>
                    <div class="searchDialog-input" style="height:100px">
                        <el-form-item label="原因">
                            <el-input auto-complete="off" v-model="cause" width="20%" size="mini" placeholder="请输入"></el-input>
                        </el-form-item>
                    </div>
                </el-row>
            </el-form>
            <el-button type="primary" size="small" @click="save">提交</el-button>
        </el-dialog>
        <!--一审审核-->
        <el-dialog title="一审核审原因" :visible.sync="open" width="45%" height="100%" label-width="100px" label-position="right">
            <el-form label-width="100px" label-position="left">
                <el-row>
                    <div class="searchDialog-input" style="height:100px">
                        <el-form-item label="原因">
                            <el-input auto-complete="off" v-model="cause" width="20%" size="mini" placeholder="请输入"></el-input>
                        </el-form-item>
                    </div>
                </el-row>
            </el-form>
            <el-button type="primary" size="small" @click="preserve">提交</el-button>
        </el-dialog>
        <!--延期-->
        <el-dialog title="延期" :visible.sync="postpones" width="45%" height="100%" label-width="100px" label-position="right">
            <el-form label-width="100px" label-position="left">
                <el-row>
                    <div class="searchDialog-input" style="height:100px">
                        <el-form-item label="请选择延期的单位" prop="timeUnit">
                            <el-select v-model="timeUnit" clearable placeholder="全部">
                                <el-option label="年" value="year"></el-option>
                                <el-option label="月" value="month"></el-option>
                                <el-option label="周" value="week"></el-option>
                                <el-option label="日" value="day"></el-option>
                                <el-option label="时" value="hour"></el-option>
                                <el-option label="分" value="minute"></el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item label="时间">
                            <el-input auto-complete="off" v-model="time" width="20%" size="mini" placeholder="请输入" onkeyup="value=value.replace(/[^\d]/g,'')"></el-input>
                        </el-form-item>
                    </div>
                </el-row>
            </el-form>
            <el-button type="primary" size="small" @click="delaying">延期</el-button>
        </el-dialog>
    </div>
</div>
</template>

<script>
//一.导包区
import jicTable from '@/components/jicComponentGallery/jicTable';
import {
    exportExcel
} from "@/utils/excel";
//二.数据输出区
export default {

    //===== 注册组件 =====
    components: {
        jicTable,
    },

    watch:{
        selectSatus(newVal,ObjVal){
            this.selections=[];
            this.searchFilters={};
            if(newVal=='audit'){
                this.findPage(null);
            }else if(newVal=='checked'){
                this.findPages(null);
            }
        },
    },

    //===== 数据初始化区=====
    data() {
        return {
            selectSatus: 'audit',
            auditOneSts: null,
            timeUnit: null,
            time: null,
            starter: 0,
            postpones: false,
            cause: null,
            choseModel: false,
            selections: [],
            open: false, //打开一审审核页面按钮
            //===== 公共数据初始化 =====
            pageIndex: 0, //当前页数：首页；
            pageSize: 10, //每页记录数：10条记录；
            totalSize: 0, //总记录数：返回数据总条数
            pageRequest: {
                pageNum: 1,
                pageSize: 10
            }, // 请求数据的参数
            tableList: [], // 表格列表数据
            searchSize: 'mini',
            platformList: [], //平台id
            departmentList: [], //部门id
            platformListAll: [], //所有平台id
            dataFormRules: {
            cause: [{
                        required: true,
                        message: "请输入申请原因",
                        trigger: "blur"
                    },
                    {
                        min: 1,
                        max: 50,
                        message: "长度在 1 到 50 个字符",
                        trigger: "blur"
                   },
               ],
            },
            tableHeaderLists: [{
                    prop: "code",
                    label: "积分卡申请编码",
                    minWidth: 250,
                    formatter: null
                },
                {
                    prop: "name",
                    label: "名称",
                    minWidth: 100,
                    formatter: null
                },
                  {
                    prop: "type",
                    label: "积分卡类型",
                    minWidth: 100,
                    formatter: function (row, column, sts, index) {
                        if (sts == 1||sts == '1') {
                            return "权益卡";
                        } else if (sts == 2 || sts == '2') {
                            return "海星卡";
                        } else if (sts == 3||sts == '3') {
                            return "定制卡";
                        } else if (sts == 4 ||sts == '4') {
                            return "贵宾卡";
                        } else if (sts == 5 ||sts == '5') {
                            return "智慧整套卡";
                        }else if(sts == 6 ||sts == '6'){
                            return "城市定制卡";
                        }
                    }
                },
                {
                    prop: "purchaseType",
                    label: "采购类型",
                    minWidth: 100,

                    formatter: function (row, column, sts, index) {
                        if (sts == 1 ||sts == '1') {
                            return "中心采购";
                        } else if (sts == 2 ||sts == '2') {
                            return "产品线采购";
                        } else if (sts == 3 ||sts == '3') {
                            return "渠道采购";
                        } else if (sts == 4 ||sts == '4') {
                            return "平台采购";
                        }
                    }

                },
                {
                    prop: "expiryTime",
                    label: "过期时间",
                    minWidth: 100,
                    formatter: null
                },
                {
                    prop: "totalNum",
                    label: "批次开卡数量",
                    minWidth: 100,
                    formatter: null
                },
                                {
                    prop: "frozenNum",
                    label: "冻结数量",
                    minWidth: 100,
                    formatter: null
                },
                {
                    prop: "leftNum",
                    label: "剩余数量",
                    minWidth: 100,
                    formatter: null
                },
                {
                    prop: "totalPoint",
                    label: "总积分",
                    minWidth: 100,
                    formatter: null
                },
                {
                    prop: "leftPoint",
                    label: "剩余积分",
                    minWidth: 100,
                    formatter: null
                },
            ],

            //=====表格表头数据=====
            tableHeaderList: [{
                    prop: "code",
                    label: "积分卡申请编码",
                    minWidth: 250,
                    formatter: null
                },
                {
                    prop: "name",
                    label: "名称",
                    minWidth: 100,
                    formatter: null
                },
                {
                    prop: "type",
                    label: "积分卡类型",
                    minWidth: 100,
                    formatter: function (row, column, sts, index) {
                        if (sts == 1||sts == '1') {
                            return "权益卡";
                        } else if (sts == 2 || sts == '2') {
                            return "海星卡";
                        } else if (sts == 3||sts == '3') {
                            return "定制卡";
                        } else if (sts == 4 ||sts == '4') {
                            return "贵宾卡";
                        } else if (sts == 5 ||sts == '5') {
                            return "智慧整套卡";
                        }else if(sts == 6 ||sts == '6'){
                            return "城市定制卡";
                        }
                    }
                },
                {
                    prop: "purchaseType",
                    label: "采购类型",
                    minWidth: 100,

                    formatter: function (row, column, sts, index) {
                        if (sts == 1 ||sts == '1') {
                            return "中心采购";
                        } else if (sts == 2 ||sts == '2') {
                            return "产品线采购";
                        } else if (sts == 3 ||sts == '3') {
                            return "渠道采购";
                        } else if (sts == 4 ||sts == '4') {
                            return "平台采购";
                        }
                    }

                },
                {
                    prop: "expiryTime",
                    label: "过期时间",
                    minWidth: 100,
                    formatter: null
                },
                {
                    prop: "totalNum",
                    label: "批次开卡数量",
                    minWidth: 100,
                    formatter: null
                },
                {
                    prop: "frozenNum",
                    label: "冻结数量",
                    minWidth: 100,
                    formatter: null
                },
                {
                    prop: "leftNum",
                    label: "剩余数量",
                    minWidth: 100,
                    formatter: null
                },
                {
                    prop: "totalPoint",
                    label: "总积分",
                    minWidth: 100,
                    formatter: null
                },
                {
                    prop: "auditSts",
                    label: "审批结果",
                    minWidth: 100,
                    formatter: function (row, column, sts, index) {
                        if (sts === '0'|| sts === 0) {
                            return "待审核";
                        } else if (sts === '1'  ||sts === 1) {
                            return "未通过";
                        } else if (sts === '2'||sts === 2) {
                            return "已通过";
                        }
                    }
                },
                {
                    prop: "auditOneSts",
                    label: "一审审核",
                    minWidth: 100,
                    formatter: function (row, column, sts, index) {
                        if (sts === '0'||sts === 0) {
                            return "待审核";
                        } else if (sts === '1'||sts === 1) {
                            return "一审审核未通过";
                        } else if (sts === '2'||sts === 2) {
                            return "一审审核通过";
                        }
                    }
                }

            ],

            //=====搜索表单对应的数据对象初始化=====
            searchFilters: {
                id: null,
                code: null,
                name: null,
                type: null,
                purchaseType: null,
                firstDemandCode: null,
                secondDemandId: null,
                expiryTime: null,
                totalNum: null,
                frozenNum: null,
                leftNum: null,
                totalPoint: null,
                isInterfaceVarify: null,
                img1: null,
                img2: null,
                img3: null,
                applyReason: null,
                createTime: null,
                updateTime: null,
                creator: null,
                updater: null,
                sts: null,
                auditorId: null,
                auditReason: null,
                auditTime: null,
                auditSts: null,
                auditOneSts: null,
            },
            //dialogVisible: false, //// 是否显示弹窗内容;
            //editDialogVisible1: false,//// 是否可编辑弹窗内容;
            //editLoading: false,////是否显示加载时动画效果;
        }
    },

    //===== 初始化页面调用方法(dom元素绑定后再执行初始化数据操作) =====
    mounted() {
        this.findPage(null);
        this.getPlatFormL();
    },

    //=====Vue.js 方法区=====
    methods: {       
        findPages(pageNum) {
          // debugger
            // 传过滤器的参数
            let this_ = this;
            if (this_.searchFilters === undefined || this_.searchFilters === null) {
                this_.searchFilters = {};
            }

            this_.searchFilters.pageNum = pageNum === null || pageNum === undefined ? this.pageRequest.pageNum : pageNum;
            this_.searchFilters.pageSize = this.pageRequest.pageSize;
            this.utils.request.findconfPointCardBatchPage(this_.searchFilters, function (res) {
                if (res.code === "0000") {
                    this_.tableList = res.data.list;
                    this_.totalSize = Number(res.data.total);
                } else {
                    this_.tableList = [];
                    this_.totalSize = 0;
                }
            });
        },
        preserve() {
            var that = this;
            if(this.cause==null){
                 that.$message({
                        message: '请输入审核原因',
                        type: 'warning'
                });
                return;
            }
            this.utils.request.updateConfPointCardAudit({
                list: that.selections,
                auditOneReason: that.cause,
                auditOneSts: that.auditOneSts
            }, function (res) {
                if (res.code === '0000') {
                    that.$message({
                        message: '审核成功',
                        type: 'success'
                    });
                } else {
                    that.$message({
                        message: '延期失败',
                        type: 'warning'
                    });
                }
                that.open = false;
                that.cause = null;
                that.findPage(null);
            })
        },
        firstInstance(num) {
            var that = this;
            if (this.selections.length <= 0) {
                that.$message({
                    showClose: true,
                    message: "必须选中一条数据!",
                    type: "warning"
                });
                return;
            }
            if (num === 'pass') {
                for (var i = 0; i < that.selections.length; i++) {
                    if (that.selections[i].auditOneSts != 0) {
                        that.$message({
                            showClose: true,
                            message: "选中的数据必须全部都是一审未审核的",
                            type: "warning"
                        });
                        return;
                    }
                }
                that.auditOneSts = 2;
            } else {
                for (var i = 0; i < that.selections.length; i++) {
                    if (that.selections[i].auditOneSts == 1 || that.selections[i].auditOneSts == 2) {
                        that.$message({
                            showClose: true,
                            message: "选中的数据不能是一审已经审核过的",
                            type: "warning"
                        });
                        return;
                    }
                }
                that.auditOneSts = 1;
            }
            this.open = true;
        },
        delaying() {
            var that = this;

            this.utils.request.deferredCard({
                list: that.selections,
                time: that.time,
                timeUnit: that.timeUnit
            }, function (res) {
                if (res.code == '0000') {
                    that.$message({
                        message: '延期成功',
                        type: 'success'
                    });
                } else {
                    that.$message({
                        message: '延期失败',
                        type: 'warning'
                    });
                }
                that.postpones = false;
                that.time = null;
                that.findPage(null);
            })
        },
         releasePointCart(){
            let that = this;
            if (this.selections.length <= 0) {
                this.$message({
                    message: "必须选中一条数据!",
                    showClose: true,
                    type: "warning"
                });
                return;
            }
            let releaseBatch = [];
            for (var i = 0; i < that.selections.length; i++) {
                if(that.selections[i].pointRelease==1){
                    that.$message({
                    message: "你选中的数据中，有些数据已经释放了",
                    showClose: true,
                    type: "error"
                     }); 
                    return;
                }
               releaseBatch.push(that.selections[i].code);
            }
            this.utils.request.releasePointCart({releaseBatch:releaseBatch},function(res){
                if(res.data == true && res.code == "0000"){
                    that.$message({
                    message: "释放成功!",
                    showClose: true,
                    type: "success"
                     }); 
                }else{
                    that.$message({
                    message: res.message,
                    showClose: true,
                    type: "error"
                     }); 
                }
            })

        },
           massProduction() {
          // debugger
            var that = this;
            if (this.selections.length <= 0) {
                this.$message({
                    message: "必须选中一条数据!",
                    showClose: true,
                    type: "warning"
                });
                return;
            }
            for (var i = 0; i < that.selections.length; i++) {
                var num = that.selections[i].leftNum - that.selections[i].frozenNum;
                if (num <= 0) {
                    that.$message({
                        message: "其中有些数据已经无法生成积分卡了",
                        showClose: true,
                        type: "warning"
                    });
                    return;
                }
            }
            this.utils.request.massProductionPointCard({
                list: this.selections
            }, function (res) {
                if (res.code === '0000') {
                    that.$message({
                        message: "批量生成成功",
                        type: 'success'
                    });
                } else {
                    that.$message({
                        message: res.msg,
                        type: 'warning'
                    });
                }
                that.findPages();
            })
        },
          handleDeletes(data) {
            this.utils.request.deleteconfPointCardBatch({
                id: data.row.id
            }, res => {
                if (res.data) {
                    this.$message({
                        message: '删除成功',
                        type: 'success'
                    });
                    this.findPage();
                } else {
                    this.$message({
                        message: '删除失败',
                        type: 'warning'
                    });
                }
            });
        },
        postpone() {
            var that = this;
            if (this.selections.length <= 0) {
                this.$message({
                    showClose: true,
                    message: "必须选中一条数据!",
                    type: "warning"
                });
                return;
            }
            for (var i = 0; i < this.selections.length; i++) {
                var date = new Date();
                if (this.selections[0].expiryTime < date) {
                    this.$message({
                        showClose: true,
                        message: "被选中的积分卡中必须没有过期",
                        type: "warning"
                    });
                    return;

                }
            }
            this.postpones = true;
        },
        batchExport() {
            var that = this;
            if (this.selections.length <= 0) {
                that.$message({
                    showClose: true,
                    message: "不能导出空数据!",
                    type: "warning"
                });
                return;
            }
            this.$confirm("确定下载列表文件?", "提示", {
                    confirmButtonText: "确定",
                    cancelButtonText: "取消",
                    type: "warning"
                })
                .then(() => {
                    if (that.selections.length == 0) {
                        exportExcel(
                            that.tableList,
                            that.tableHeaderList,
                            "积分卡数据导出"
                        );
                    } else {
                        exportExcel(
                            that.selections,
                            that.tableHeaderList,
                            "积分卡数据导出"
                        );
                    }

                })
                .catch(() => {});
        },
        save() {
            let that = this;
            if (this.cause === null || this.cause === undefined) {
                this.$message({
                    showClose: true,
                    message: "请输入核审原因!",
                    type: "warning"
                });
                return;
            }
            if (that.starter === 2) {
                for (var i = 0; i < that.selections.length; i++) {
                    that.selections[i].auditReason = that.cause;
                    that.selections[i].auditSts = 2;
                    that.selections[i].sts = 1;
                }
            } else {
                for (var i = 0; i < that.selections.length; i++) {
                    that.selections[i].auditReason = that.cause;
                    that.selections[i].auditSts = 1;
                    that.selections[i].sts = 2;
                }
            }
            this.utils.request.updateConfPointCards({
                list: that.selections
            }, function (res) {
                if (res.code == "0000") {
                    that.choseModel = false;
                    that.$message({
                        message: '核审成功',
                        type: 'success'
                    });
                    that.cause = null;
                    that.findPage(null);
                } else {
                    that.$message({
                        showClose: true,
                        message: "核审失败",
                        type: "error"
                    });
                }
            })
            this.cause = null;
        },
        verify(name) {
            var that = this;
            if (that.selections.length === 0) {
                this.$message({
                    showClose: true,
                    message: "必须选中一条数据!",
                    type: "warning"
                });
                return;
            }

            for (var i = 0; i < that.selections.length; i++) {
                if (that.selections[i].auditSts === '2' || that.selections[i].auditSts === 2) {
                    that.$message({
                        showClose: true,
                        message: "不能选中已经核实成功的数据",
                        type: "warning"
                    });
                    return;
                }
                if (that.selections[i].auditOneSts != 2) {
                    that.$message({
                        showClose: true,
                        message: "选中的数据必须全部一审审核通过",
                        type: "warning"
                    });
                    return;
                }
            }
            if (name === 'pass') {
                that.starter = 2;
                that.choseModel = true;
            } else {
                that.starter = 1;
                that.choseModel = true;
            }
        },

        //1.查询按钮：查询列表数据
        findPage(pageNum) {
            // 传过滤器的参数
            let this_ = this;
            if (this_.searchFilters === undefined || this_.searchFilters === null) {
                this_.searchFilters = {};
            }

            this_.searchFilters.pageNum = pageNum === null || pageNum === undefined ? this.pageRequest.pageNum : pageNum;
            this_.searchFilters.pageSize = this.pageRequest.pageSize;
            this.utils.request.findConfPointCardApplyPage(this_.searchFilters, function (res) {
                if (res.code === "0000") {
                    this_.tableList = res.data.list;
                    this_.totalSize = Number(res.data.total);
                } else {
                    this_.tableList = [];
                    this_.totalSize = 0;
                }
            });
        },
        getPlatFormL() {
            var this_ = this;
            this.utils.request.findConfPlatform({}, function (res) {
                if (res.code === "0000") {
                    this_.platformList = res.data;
                } else {
                    this_.platformList = [];
                }
            })
        },

        // 2.重置按钮：无条件查询搜索框条件
        resetForm(formName) {
            this.searchFilters = {};
            if(this.selectSatus=='audit'){
                this.findPage(null);
            }else{
                this.findPages(null);
            }
        },

        // 3.详情按钮对应的方法
        handleDetail(params) {
            if(this.selectSatus=='audit'){
                this.$router.push({
                    path: "/ConfPointCardApplyDetail/",
                    query: {
                        id: params.row.id,
                        disabled: true,
                        show: true,
                        add:false
                    }
                });
            }else{
                  this.$router.push({
                path: "/ConfPointCardBatchDetail/",
                query: {
                    id: params.row.id,
                    disabled: true,
                    show: true,
                    add:false
                }
            });
            }

            
        },

        // 4.编辑按钮对应的方法
        handleEdit(params) {
            if(this.selectSatus=='audit'){
                this.$router.push({
                    path: "/ConfPointCardApplyDetail/",
                    query: {
                        id: params.row.id,
                        disabled: false,
                        show: false,
                        add:false
                    }
                });
            }else{
            this.$router.push({
                path: "/ConfPointCardBatchDetail/",
                query: {
                    id: params.row.id,
                    disabled: false,
                    show: false,
                    add:false
                }
            });
            }
        },

        // 5.跳转到新增记录页面；
        addForm(params) {
            params = {
                row: {
                    id: null
                }
            };
            this.$router.push({
                path: "/ConfPointCardApplyDetail/",
                query: {
                    id: params.row.id,
                    disabled: false,
                    show: false,
                    add:true
                }
            });
        },
        // 6.每页记录数发生变化
        handleSizeChange(params) {
            this.pageRequest.pageSize = params.size;
        },

        // 7.请求页数发生变化
        handlePageChange(params) {
            this.pageRequest.pageNum = params.number;
            this.findPage();
        },
        // 8.页面弹窗处理方法
        add() {
            this.dialogVisible = true;
        },
        selectionChange(selections) {
            this.selections = selections.selections;
        },

        // 9.关闭弹窗
        handleClose() {
            this.dialogVisible = false;
        },

        // 10.删除按钮：删除选中的记录
        handleDelete(data) {
            if(this.selectSatus=='audit'){
                this.utils.request.deleteConfPointCardApply({
                    id: data.row.id
                }, res => {
                    if (res.data) {
                        this.$message({
                            message: '删除成功',
                            type: 'success'
                        });
                        this.findPage();
                    } else {
                        this.$message({
                            message: '删除失败',
                            type: 'warning'
                        });
                    }
                });
            }else{
              this.utils.request.deleteconfPointCardBatch({
                id: data.row.id
                }, res => {
                    if (res.data) {
                        this.$message({
                            message: '删除成功',
                            type: 'success'
                        });
                        this.findPages();
                    } else {
                        this.$message({
                            message: '删除失败',
                            type: 'warning'
                        });
                    }
                });
            }
        }
        //==========Vue.js自定义方法区==========

    },
}
</script>

<style lang="scss" scoped>
/* ele组件样式重置 */
.common-content {
    padding: 10px;
    box-sizing: border-box;

    .search-wrap /deep/ {
        .el-form-item__label {
            height: 32px;
            line-height: 32px;
        }

        .el-form-item__content {
            height: 32px;
            line-height: 32px;
            width: 150px;
        }

        .el-input--mini .el-input__inner {
            height: 32px;
            line-height: 32px;
        }

        .el-date-editor.el-input,
        .el-date-editor.el-input__inner {
            width: 150px;
        }
    }

    /* 多日期样式重置 */
    .el-dater /deep/ .el-form-item__content {
        width: 330px;
    }

    /* 通用工具部分样式 */
    .tool-wrap {
        width: 100%;
        height: auto;
        position: relative;
        overflow: hidden;

        .left-area {
            float: left;
            width: 50%;
            text-align: left;

            button {
                margin-right: 15px;
                border-radius: 5px;
            }
        }

        .right-area {
            float: right;
            width: 50%;
            text-align: right;
        }
    }

    /* 表格部分样式 */
    .table-wrap {
        width: 100%;
        max-height: 600px;
        margin-top: 20px;
    }

    /* 弹窗样式 */
    .dialog-wrap /deep/ .el-dialog__footer {
        text-align: center !important;
    }
}
</style>
